package com.googlecode.sqldatagenerator.model.dto;

import java.io.Serializable;

import org.springframework.util.ObjectUtils;

public class TableDto implements Serializable, Cloneable {

    private static final long serialVersionUID = 7314922795694461506L;

    private String tableName;
    
    //TODO: private List<ColumnDto> columns;
    
    //TODO: private List<ForeignKeyDto> foreingKeys;

    public String getTableName() {
        return tableName;
    }

    public void setTableName(String tableName) {
        this.tableName = tableName;
    }
    
    @Override
    public boolean equals(Object obj) {
        if (obj == null || obj.getClass() != getClass()){
            return false;
        }
        return ObjectUtils.nullSafeEquals(((TableDto)obj).tableName, tableName);
    }
    
    @Override
    public int hashCode() {
        return tableName == null ? 0 : tableName.hashCode();
    }
    
    @Override
    public TableDto clone() {
        try {
            TableDto r = (TableDto) super.clone();
            return r;
        } catch (CloneNotSupportedException e) {
            throw new RuntimeException(e);
        }
    }
}
